package com.asiainfo.iam.mapper;


import com.asiainfo.iam.entity.po.ModoTeam;
import org.apache.ibatis.annotations.*;

import java.time.LocalDateTime;

@Mapper
public interface ModoTeamMapper {
    @Insert("insert into modo_team(team_id, " +
            "team_name, " +
            "parent_team_id, " +
            "parent_team_name, " +
            "label, " +
            "descr, " +
            "state, " +
            "create_user, " +
            "create_dt, " +
            "lastupd, " +
            "update_user,"+
            "version)" +
            "values(#{teamId}, #{teamName}, #{parentTeamId}, " +
            "#{parentTeamName}, #{label}, #{descr}, " +
            "#{state}, #{createUser}, #{createDt}, #{lastupd}, #{updateUser}, #{version})")
    int insert(ModoTeam modoTeam);

    @Select("select * from modo_team where team_id = #{id}")
    ModoTeam findById(String id);

    @Delete("delete from modo_team where team_id = #{teamId}")
    void deleteById(String orgId);

    @Update("UPDATE modo_team " +
            "SET team_name = #{teamName}, " +
            "    parent_team_id = #{parentTeamId}, " +
            "    parent_team_name = #{parentTeamName}, " +
            "    label = #{label}, " +
            "    descr = #{descr}, " +
            "    state = #{state}, " +
            "    create_user = #{createUser}, " +
            "    create_dt = #{createDt}, " +
            "    lastupd = #{lastupd}, " +
            "    update_user = #{updateUser}, " +
            "    version = #{version} " +
            "WHERE team_id = #{teamId}")
    void update(ModoTeam modoTeam);
}
